/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package modelo;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Santiago.Escobar.M
 */
@Entity
@Table(name = "conductorruta")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Conductorruta.findAll", query = "SELECT c FROM Conductorruta c"),
    @NamedQuery(name = "Conductorruta.findByIdconductorruta", query = "SELECT c FROM Conductorruta c WHERE c.idconductorruta = :idconductorruta")})
public class Conductorruta implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "idconductorruta")
    private Long idconductorruta;
    @JoinColumn(name = "username", referencedColumnName = "username")
    @ManyToOne(optional = false)
    private Usuario username;
    @JoinColumn(name = "idrutavehiculo", referencedColumnName = "idrutavehiculo")
    @ManyToOne(optional = false)
    private Rutavehiculo idrutavehiculo;

    public Conductorruta() {
    }

    public Conductorruta(Long idconductorruta) {
        this.idconductorruta = idconductorruta;
    }

    public Long getIdconductorruta() {
        return idconductorruta;
    }

    public void setIdconductorruta(Long idconductorruta) {
        this.idconductorruta = idconductorruta;
    }

    public Usuario getUsername() {
        return username;
    }

    public void setUsername(Usuario username) {
        this.username = username;
    }

    public Rutavehiculo getIdrutavehiculo() {
        return idrutavehiculo;
    }

    public void setIdrutavehiculo(Rutavehiculo idrutavehiculo) {
        this.idrutavehiculo = idrutavehiculo;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idconductorruta != null ? idconductorruta.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Conductorruta)) {
            return false;
        }
        Conductorruta other = (Conductorruta) object;
        if ((this.idconductorruta == null && other.idconductorruta != null) || (this.idconductorruta != null && !this.idconductorruta.equals(other.idconductorruta))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "modelo.Conductorruta[ idconductorruta=" + idconductorruta + " ]";
    }
    
}
